<%= form_for(user) do |f| %>
    <% if user.errors.any? %>
        <div id="errorExplanation">
          <h2><%= pluralize(user.errors.count, "error") %> prohibited
            this post from being saved:</h2>
          <ul>
            <% user.errors.full_messages.each do |msg| %>
                <li><%= msg %></li>
            <% end %>
          </ul>
        </div>
    <% end %>

    <div class="field">
      <%= f.label :name %><br />
      <%= f.text_field :name %>
    </div>
    <div class="field">
      <%= f.label :email %><br />
      <%= f.text_field :email %>
    </div>
    <div class="field">
      <%= f.label :password %><br />
      <%= f.password_field :password %>
    </div>
    <div class="field">
      <%= f.label :password_confirmation %><br />
      <%= f.password_field :password_confirmation %>
    </div>
    <div class="field">
      <%= f.label :birth  %><br />
      <%= f.date_select :birth, :start_year => 70.years.ago.year, :end_year => 18.years.ago.year, :max_years_allowed => 100 %>
    </div>

    <% if (not current_user.nil?) and (current_user.role?("Administrator")) %>
        <div class="field">
          <%= f.label :roles %><br />
          <%@roles.each do |role|%>
          <%= check_box_tag "user[role_ids][]", role.id, user.roles.include?(role) %>
          <%= role.name%><br />
          <% end %>
        </div>
    <% end %>


    <div class="actions">
      <%= f.submit %>
    </div>
<% end %>